<!DOCTYPE html>
<html >
<head>

    <!--[if lt IE 9]>
        <style>body {display: none; background: none !important} </style>
        <meta http-equiv="Refresh" Content="0; url=//outdatedbrowser.com/" />
    <![endif]-->

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="format-detection" content="telephone=no" />
<meta name="author" content="xiaoyou" />



<meta name="description" content="阿里巴巴有2大核心的分布式技术，一个是OceanBase，另一个就是RocketMQ。在实际项目中已经领教过RocketMQ的强大，本人计划写一个RocketMQ实战系列，将涵盖RocketMQ的简介，环境搭建，初步使用、API详解、架构分析、管理员集群操作等知识。">
<meta name="keywords" content="RocketMQ">
<meta property="og:type" content="article">
<meta property="og:title" content="RocketMQ实战（一）">
<meta property="og:url" content="http://yoursite.com/2017/04/10/rocket-in-practice-1/index.html">
<meta property="og:site_name" content="Lost Youth">
<meta property="og:description" content="阿里巴巴有2大核心的分布式技术，一个是OceanBase，另一个就是RocketMQ。在实际项目中已经领教过RocketMQ的强大，本人计划写一个RocketMQ实战系列，将涵盖RocketMQ的简介，环境搭建，初步使用、API详解、架构分析、管理员集群操作等知识。">
<meta property="og:image" content="http://oo77gy3uq.bkt.clouddn.com/1240.">
<meta property="og:image" content="http://oo77gy3uq.bkt.clouddn.com/1240.">
<meta property="og:image" content="http://oo77gy3uq.bkt.clouddn.com/1240.">
<meta property="og:image" content="http://oo77gy3uq.bkt.clouddn.com/1240.">
<meta property="og:image" content="http://oo77gy3uq.bkt.clouddn.com/1240.">
<meta property="og:image" content="http://oo77gy3uq.bkt.clouddn.com/1240.">
<meta property="og:image" content="http://oo77gy3uq.bkt.clouddn.com/1240.">
<meta property="og:image" content="http://oo77gy3uq.bkt.clouddn.com/1240.">
<meta property="og:image" content="http://oo77gy3uq.bkt.clouddn.com/1240.">
<meta property="og:image" content="http://oo77gy3uq.bkt.clouddn.com/1240.">
<meta property="og:image" content="http://oo77gy3uq.bkt.clouddn.com/1240.">
<meta property="og:image" content="http://oo77gy3uq.bkt.clouddn.com/1240.">
<meta property="og:image" content="http://oo77gy3uq.bkt.clouddn.com/1240.">
<meta property="og:image" content="http://oo77gy3uq.bkt.clouddn.com/1240.">
<meta property="og:image" content="http://oo77gy3uq.bkt.clouddn.com/1240.">
<meta property="og:image" content="http://oo77gy3uq.bkt.clouddn.com/1240.">
<meta property="og:image" content="http://oo77gy3uq.bkt.clouddn.com/1240.">
<meta property="og:image" content="http://oo77gy3uq.bkt.clouddn.com/1240.">
<meta property="og:updated_time" content="2017-04-26T06:04:51.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="RocketMQ实战（一）">
<meta name="twitter:description" content="阿里巴巴有2大核心的分布式技术，一个是OceanBase，另一个就是RocketMQ。在实际项目中已经领教过RocketMQ的强大，本人计划写一个RocketMQ实战系列，将涵盖RocketMQ的简介，环境搭建，初步使用、API详解、架构分析、管理员集群操作等知识。">
<meta name="twitter:image" content="http://oo77gy3uq.bkt.clouddn.com/1240.">

<link rel="apple-touch-icon" href= "/apple-touch-icon.png">


    <link rel="alternate" href="/atom.xml" title="Lost Youth" type="application/atom+xml">



    <link rel="shortcut icon" href="/favicon.png">



    <link href="//cdn.bootcss.com/animate.css/3.5.1/animate.min.css" rel="stylesheet">



    <link href="//cdn.bootcss.com/fancybox/2.1.5/jquery.fancybox.min.css" rel="stylesheet">



    <script src="//cdn.bootcss.com/pace/1.0.2/pace.min.js"></script>
    <link href="//cdn.bootcss.com/pace/1.0.2/themes/blue/pace-theme-minimal.css" rel="stylesheet">


<link rel="stylesheet" href="/css/style.css">



<link href="//cdn.bootcss.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet">


<title>RocketMQ实战（一） | Lost Youth</title>

<script src="//cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>
<script src="//cdn.bootcss.com/clipboard.js/1.5.10/clipboard.min.js"></script>

<script>
    var yiliaConfig = {
        fancybox: true,
        animate: true,
        isHome: false,
        isPost: true,
        isArchive: false,
        isTag: false,
        isCategory: false,
        fancybox_js: "//cdn.bootcss.com/fancybox/2.1.5/jquery.fancybox.min.js",
        scrollreveal: "//cdn.bootcss.com/scrollReveal.js/3.1.4/scrollreveal.min.js",
        search: undefined
    }
</script>


    <script> yiliaConfig.jquery_ui = [false]; </script>



    <script> yiliaConfig.rootUrl = "\/";</script>






</head>
<body>
  <div id="container">
    <div class="left-col">
    <div class="overlay"></div>
<div class="intrude-less">
    <header id="header" class="inner">
        <a href="/" class="profilepic">
            <img src="/img/avatar.png" class="animated zoomIn">
        </a>
        <hgroup>
          <h1 class="header-author"><a href="/">xiaoyou</a></h1>
        </hgroup>

        

        


        
            <div id="switch-btn" class="switch-btn">
                <div class="icon">
                    <div class="icon-ctn">
                        <div class="icon-wrap icon-house" data-idx="0">
                            <div class="birdhouse"></div>
                            <div class="birdhouse_holes"></div>
                        </div>
                        <div class="icon-wrap icon-ribbon hide" data-idx="1">
                            <div class="ribbon"></div>
                        </div>
                        
                        <div class="icon-wrap icon-link hide" data-idx="2">
                            <div class="loopback_l"></div>
                            <div class="loopback_r"></div>
                        </div>
                        
                        
                        <div class="icon-wrap icon-me hide" data-idx="3">
                            <div class="user"></div>
                            <div class="shoulder"></div>
                        </div>
                        
                    </div>
                    
                </div>
                <div class="tips-box hide">
                    <div class="tips-arrow"></div>
                    <ul class="tips-inner">
                        <li>菜单</li>
                        <li>标签</li>
                        
                        <li>友情链接</li>
                        
                        
                        <li>关于我</li>
                        
                    </ul>
                </div>
            </div>
        

        <div id="switch-area" class="switch-area">
            <div class="switch-wrap">
                <section class="switch-part switch-part1">
                    <nav class="header-menu">
                        <ul>
                        
                            <li><a href="/">Home</a></li>
                        
                            <li><a href="/archives">Archives</a></li>
                        
                            <li><a href="/tools">Tools</a></li>
                        
                            <li><a href="/about">About</a></li>
                        
                        </ul>
                    </nav>
                    <nav class="header-nav">
                        <ul class="social">
                            
                                <a class="fa Email" href="mailto:123@123.com" title="Email"></a>
                            
                                <a class="fa GitHub" href="#" title="GitHub"></a>
                            
                                <a class="fa RSS" href="/atom.xml" title="RSS"></a>
                            
                        </ul>
                    </nav>
                </section>
                
                
                <section class="switch-part switch-part2">
                    <div class="widget tagcloud" id="js-tagcloud">
                        <ul class="tag-list"><li class="tag-list-item"><a class="tag-list-link" href="/tags/Git/">Git</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Java8/">Java8</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/MySql/">MySql</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/RocketMQ/">RocketMQ</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Spring-Boot/">Spring Boot</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Tomcat/">Tomcat</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/分布式-服务化/">分布式 服务化</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/唯一ID/">唯一ID</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/微服务/">微服务</a></li></ul>
                    </div>
                </section>
                
                
                
                <section class="switch-part switch-part3">
                    <div id="js-friends">
                    
                      <a class="main-nav-link switch-friends-link" href="https://hexo.io">Hexo</a>
                    
                      <a class="main-nav-link switch-friends-link" href="https://pages.github.com/">GitHub</a>
                    
                      <a class="main-nav-link switch-friends-link" href="http://moxfive.xyz/">MOxFIVE</a>
                    
                    </div>
                </section>
                

                
                
                <section class="switch-part switch-part4">
                
                    <div id="js-aboutme">Man</div>
                </section>
                
            </div>
        </div>
    </header>                
</div>
    </div>
    <div class="mid-col">
      <nav id="mobile-nav">
      <div class="overlay">
          <div class="slider-trigger"></div>
          <h1 class="header-author js-mobile-header hide"><a href="/" title="回到主页">xiaoyou</a></h1>
      </div>
    <div class="intrude-less">
        <header id="header" class="inner">
            <a href="/" class="profilepic">
                <img src="/img/avatar.png" class="animated zoomIn">
            </a>
            <hgroup>
              <h1 class="header-author"><a href="/" title="回到主页">xiaoyou</a></h1>
            </hgroup>
            
            <nav class="header-menu">
                <ul>
                
                    <li><a href="/">Home</a></li>
                
                    <li><a href="/archives">Archives</a></li>
                
                    <li><a href="/tools">Tools</a></li>
                
                    <li><a href="/about">About</a></li>
                
                <div class="clearfix"></div>
                </ul>
            </nav>
            <nav class="header-nav">
                        <ul class="social">
                            
                                <a class="fa Email" target="_blank" href="mailto:123@123.com" title="Email"></a>
                            
                                <a class="fa GitHub" target="_blank" href="#" title="GitHub"></a>
                            
                                <a class="fa RSS" target="_blank" href="/atom.xml" title="RSS"></a>
                            
                        </ul>
            </nav>
        </header>                
    </div>
    <link class="menu-list" tags="标签" friends="友情链接" about="关于我"/>
</nav>
      <div class="body-wrap"><article id="post-rocket-in-practice-1" class="article article-type-post" itemscope itemprop="blogPost">
  
    <div class="article-meta">
      <a href="/2017/04/10/rocket-in-practice-1/" class="article-date">
      <time datetime="2017-04-10T14:58:00.000Z" itemprop="datePublished">2017-04-10</time>
</a>


    </div>
  
  <div class="article-inner">
    
      <input type="hidden" class="isFancy" />
    
    
      <header class="article-header">
        
  
    <h1 class="article-title" itemprop="name">
      RocketMQ实战（一）
    </h1>
  

      </header>
      
      <div class="article-info article-info-post">
        

        
    <div class="article-tag tagcloud">
        <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/RocketMQ/">RocketMQ</a></li></ul>
    </div>

        <div class="clearfix"></div>
      </div>
      
    
    <div class="article-entry" itemprop="articleBody">
      
          
        <p><strong>阿里巴巴有2大核心的分布式技术，一个是OceanBase，另一个就是RocketMQ。在实际项目中已经领教过RocketMQ的强大，本人计划写一个RocketMQ实战系列，将涵盖RocketMQ的简介，环境搭建，初步使用、API详解、架构分析、管理员集群操作等知识。</strong></p>
<h1 id="What-is-RocketMQ"><a href="#What-is-RocketMQ" class="headerlink" title="What is RocketMQ?"></a>What is RocketMQ?</h1><p>RocketMQ作为一款分布式的消息中间件（阿里的说法是不遵循任何规范的，所以不能完全用JMS的那一套东西来看它），经历了Metaq1.x、Metaq2.x的发展和淘宝双十一的洗礼，在功能和性能上远超ActiveMQ。</p>
<blockquote>
<p><strong>1.要知道RocketMQ原生就是支持分布式的，而ActiveMQ原生存在单点性。</strong></p>
<p><strong>2.RocketMQ可以保证严格的消息顺序，而ActiveMQ无法保证！</strong></p>
<p><strong>3.RocketMQ提供亿级消息的堆积能力，这不是重点，重点是堆积了亿级的消息后，依然保持写入低延迟！</strong></p>
<p><strong>4.丰富的消息拉取模式（Push or Pull）</strong></p>
<p><strong>Push好理解，比如在消费者端设置Listener回调；而Pull，控制权在于应用，即应用需要主动的调用拉消息方法从Broker获取消息，这里面存在一个消费位置记录的问题（如果不记录，会导致消息重复消费）。</strong></p>
<p><strong>5.在Metaq1.x/2.x的版本中，分布式协调采用的是Zookeeper，而RocketMQ自己实现了一个NameServer，更加轻量级，性能更好！</strong></p>
<p><strong>6.消息失败重试机制、高效的订阅者水平扩展能力、强大的API、事务机制等等（后续详细介绍）</strong></p>
</blockquote>
<h1 id="初步理解Producer-Consumer-Group"><a href="#初步理解Producer-Consumer-Group" class="headerlink" title="初步理解Producer/Consumer Group"></a>初步理解Producer/Consumer Group</h1><p>ActiveMQ中并没有Group这个概念，而在RocketMQ中理解Group的机制很重要。</p>
<p><img src="http://oo77gy3uq.bkt.clouddn.com/1240." alt=""></p>
<p>Group机制</p>
<blockquote>
<p><strong>想过没有，通过Group机制，让RocketMQ天然的支持消息负载均衡！</strong></p>
<p><strong>比如某个Topic有9条消息，其中一个Consumer Group有3个实例（3个进程 OR 3台机器），那么每个实例将均摊3条消息！（注意RocketMQ只有一种模式，即发布订阅模式。）</strong></p>
</blockquote>
<h1 id="install-RocketMQ"><a href="#install-RocketMQ" class="headerlink" title="install RocketMQ"></a>install RocketMQ</h1><blockquote>
<p><strong>RocketMQ的Broker集群部署模式还挺多的，比如单Master模式、多Master模式、多Master多Slave模式（异步复制）、多Master多Slave模式（同步双写）等。明确个概念，RocketMQ Slave不可以写，可以读，类似于MySQL的主从机制。</strong></p>
<p><strong>单Master模式：
</strong></p>
<p><strong>无需多言，一旦单个broker重启或宕机，一切都结束了！很显然，线上不可以使用。</strong></p>
<p><strong>多Master模式：</strong></p>
<p><strong>全是Master，没有Slave。当然，一个broker宕机了，应用是无影响的，缺点在于宕机的Master上未被消费的消息在Master没有恢复之前不可以订阅。</strong></p>
<p><strong>多Master多Slave模式（异步复制）：</strong></p>
<p><strong>多对Master-Slave，高可用！采用异步复制的方式，主备之间短暂延迟，MS级别。Master宕机，消费者可以从Slave上进行消费，不受影响，但是Master的宕机，会导致丢失掉极少量的消息。</strong></p>
<p><strong>多Master多Slave模式（同步双写）：</strong></p>
<p><strong>和上面的区别点在于采用的是同步方式，也就是在Master/Slave都写成功的前提下，向应用返回成功，可见不论是数据，还是服务都没有单点，都非常可靠！缺点在于同步的性能比异步稍低。</strong></p>
</blockquote>
<p>这里我将采用2个Master的方式进行搭建演示，会了双Master，其他的将很简单。（多Master在实际中也是非常常用的，如果并发非常大，考虑多Master多Slave模式）</p>
<p><img src="http://oo77gy3uq.bkt.clouddn.com/1240." alt=""></p>
<p>双Master模式架构</p>
<blockquote>
<p>在192.168.99.121/122机器上各一个NameServer、Master进程。</p>
</blockquote>
<p>以192.168.99.121为例：</p>
<h3 id="第一步，修改-etc-hosts文件"><a href="#第一步，修改-etc-hosts文件" class="headerlink" title="第一步，修改/etc/hosts文件"></a><strong>第一步，修改/etc/hosts文件</strong></h3><p><img src="http://oo77gy3uq.bkt.clouddn.com/1240." alt=""></p>
<p>hosts配置</p>
<p><img src="http://oo77gy3uq.bkt.clouddn.com/1240." alt=""></p>
<p>确保相互之间可以ping通</p>
<h3 id="第二步，解压并创建存储路径"><a href="#第二步，解压并创建存储路径" class="headerlink" title="第二步，解压并创建存储路径"></a><strong>第二步，解压并创建存储路径</strong></h3><blockquote>
<p><strong>tar -xvf alibaba-rocketmq-3.2.6.tar.gz
</strong></p>
<p><strong>mkdir -p alibaba-rocketmq/store/{commitlog,consumequeue,index}</strong></p>
</blockquote>
<h3 id="第三步，配置文件"><a href="#第三步，配置文件" class="headerlink" title="第三步，配置文件"></a><strong>第三步，配置文件</strong></h3><p><img src="http://oo77gy3uq.bkt.clouddn.com/1240." alt=""></p>
<p>broker-x.properties</p>
<p><img src="http://oo77gy3uq.bkt.clouddn.com/1240." alt=""></p>
<p>配置项</p>
<blockquote>
<p>上面已经将实际中常用的配置项给出来了！</p>
</blockquote>
<h3 id="第四步，修改日志配置文件"><a href="#第四步，修改日志配置文件" class="headerlink" title="第四步，修改日志配置文件"></a><strong>第四步，修改日志配置文件</strong></h3><p><img src="http://oo77gy3uq.bkt.clouddn.com/1240." alt=""></p>
<p>注意到logback.*.xml配置文件中：</p>
<p><img src="http://oo77gy3uq.bkt.clouddn.com/1240." alt=""></p>
<p>需要替换${user.name}</p>
<p>可以使用sed进行替换：</p>
<blockquote>
<p><strong>sed -i ‘s#${user.home}#/software/alibaba-rocketmq#g’ *.xml
</strong></p>
</blockquote>
<h3 id="第五步，修改启动脚本中的JVM参数"><a href="#第五步，修改启动脚本中的JVM参数" class="headerlink" title="第五步，修改启动脚本中的JVM参数"></a><strong>第五步，修改启动脚本中的JVM参数</strong></h3><p><img src="http://oo77gy3uq.bkt.clouddn.com/1240." alt=""></p>
<p>vim runbroker.sh/rumserver.sh</p>
<blockquote>
<p><strong>注意，在这里我将JVM的堆的初始化和最大大小统一设置为1G，并将新生代大小设置为512M。主要是考虑到我的虚拟机内存，实际上在线上是可以走默认的4G堆内存的。</strong></p>
</blockquote>
<h3 id="第六步，启动NameServer"><a href="#第六步，启动NameServer" class="headerlink" title="第六步，启动NameServer"></a><strong>第六步，启动NameServer</strong></h3><blockquote>
<p><strong>nohup sh mqnamesrv &amp;
</strong></p>
</blockquote>
<p><img src="http://oo77gy3uq.bkt.clouddn.com/1240." alt=""></p>
<p>NameServer</p>
<p><img src="http://oo77gy3uq.bkt.clouddn.com/1240." alt=""></p>
<p>nameserver启动日志</p>
<h3 id="第七步，启动broker-X"><a href="#第七步，启动broker-X" class="headerlink" title="第七步，启动broker-X"></a><strong>第七步，启动broker-X</strong></h3><p><img src="http://oo77gy3uq.bkt.clouddn.com/1240." alt=""></p>
<p>启动broker</p>
<p>注意观察日志：</p>
<p><img src="http://oo77gy3uq.bkt.clouddn.com/1240." alt=""></p>
<p>broker.log</p>
<p><img src="http://oo77gy3uq.bkt.clouddn.com/1240." alt=""></p>
<p>进程与端口</p>
<h3 id="第八步：RocketMQ-Console"><a href="#第八步：RocketMQ-Console" class="headerlink" title="第八步：RocketMQ Console"></a><strong>第八步：RocketMQ Console</strong></h3><blockquote>
<p>把rocketmq-console.war部署到Tomcat下即可。</p>
</blockquote>
<p><img src="http://oo77gy3uq.bkt.clouddn.com/1240." alt=""></p>
<p>解压WAR包</p>
<p><img src="http://oo77gy3uq.bkt.clouddn.com/1240." alt=""></p>
<p>在解压WAR包后的CLASS下更改config.properties</p>
<p><img src="http://oo77gy3uq.bkt.clouddn.com/1240." alt=""></p>
<p>好久不见，TOM猫</p>
<p><img src="http://oo77gy3uq.bkt.clouddn.com/1240." alt=""></p>
<p>rocketmq管控台</p>
<blockquote>
<p><strong>这个管控台实际上还是比较简陋的，我们使用比较多的是mqadmin操作命令，后续会介绍。</strong></p>
</blockquote>
<p><strong>OK，到这里，双Master的搭建已经完成了！</strong></p>
<p><strong>本篇博客到此为止，下期再见，晚安！</strong></p>

      
    </div>
    
  </div>
  
    
    <div class="copyright">
        <p><span>本文标题:</span><a href="/2017/04/10/rocket-in-practice-1/">RocketMQ实战（一）</a></p>
        <p><span>文章作者:</span><a href="/" title="回到主页">xiaoyou</a></p>
        <p><span>发布时间:</span>2017-04-10, 22:58:00</p>
        <p><span>最后更新:</span>2017-04-26, 14:04:51</p>
        <p>
            <span>原始链接:</span><a class="post-url" href="/2017/04/10/rocket-in-practice-1/" title="RocketMQ实战（一）">http://yoursite.com/2017/04/10/rocket-in-practice-1/</a>
            <span class="copy-path" data-clipboard-text="原文: http://yoursite.com/2017/04/10/rocket-in-practice-1/　　作者: xiaoyou" title="点击复制文章链接"><i class="fa fa-clipboard"></i></span>
            <script> var clipboard = new Clipboard('.copy-path'); </script>
        </p>
        <p>
            <span>许可协议:</span><i class="fa fa-creative-commons"></i> <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/" title="CC BY-NC-SA 4.0 International" target = "_blank">"署名-非商用-相同方式共享 4.0"</a> 转载请保留原文链接及作者。
        </p>
    </div>



    <nav id="article-nav">
        
            <div id="article-nav-newer" class="article-nav-title">
                <a href="/2017/04/10/head-first-git-branch/">
                    Git由浅入深之分支管理
                </a>
            </div>
        
        
            <div id="article-nav-older" class="article-nav-title">
                <a href="/2017/04/22/meituan-id/">
                    Leaf——美团点评分布式ID生成系统
                </a>
            </div>
        
    </nav>

  
</article>

    <div id="toc" class="toc-article">
        <strong class="toc-title">文章目录</strong>
        
            <ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#What-is-RocketMQ"><span class="toc-number">1.</span> <span class="toc-text">What is RocketMQ?</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#初步理解Producer-Consumer-Group"><span class="toc-number">2.</span> <span class="toc-text">初步理解Producer/Consumer Group</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#install-RocketMQ"><span class="toc-number">3.</span> <span class="toc-text">install RocketMQ</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#第一步，修改-etc-hosts文件"><span class="toc-number">3.0.1.</span> <span class="toc-text">第一步，修改/etc/hosts文件</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#第二步，解压并创建存储路径"><span class="toc-number">3.0.2.</span> <span class="toc-text">第二步，解压并创建存储路径</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#第三步，配置文件"><span class="toc-number">3.0.3.</span> <span class="toc-text">第三步，配置文件</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#第四步，修改日志配置文件"><span class="toc-number">3.0.4.</span> <span class="toc-text">第四步，修改日志配置文件</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#第五步，修改启动脚本中的JVM参数"><span class="toc-number">3.0.5.</span> <span class="toc-text">第五步，修改启动脚本中的JVM参数</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#第六步，启动NameServer"><span class="toc-number">3.0.6.</span> <span class="toc-text">第六步，启动NameServer</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#第七步，启动broker-X"><span class="toc-number">3.0.7.</span> <span class="toc-text">第七步，启动broker-X</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#第八步：RocketMQ-Console"><span class="toc-number">3.0.8.</span> <span class="toc-text">第八步：RocketMQ Console</span></a></li></ol></li></ol></li></ol>
        
    </div>
    <style>
        .left-col .switch-btn,
        .left-col .switch-area {
            display: none;
        }
        .toc-level-3 i,
        .toc-level-3 ol {
            display: none !important;
        }
    </style>

    <input type="button" id="tocButton" value="隐藏目录"  title="点击按钮隐藏或者显示文章目录">

    <script>
        yiliaConfig.toc = ["隐藏目录", "显示目录", !!"false"];
    </script>



    
<div class="share">
    
        <div class="bdsharebuttonbox">
            <a href="#" class="fa fa-twitter bds_twi" data-cmd="twi" title="分享到推特"></a>
            <a href="#" class="fa fa-weibo bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a>
            <a href="#" class="fa fa-qq bds_sqq" data-cmd="sqq" title="分享给 QQ 好友"></a>
            <a href="#" class="fa fa-files-o bds_copy" data-cmd="copy" title="复制网址"></a>
            <a href="#" class="fa fa fa-envelope-o bds_mail" data-cmd="mail" title="通过邮件分享"></a>
            <a href="#" class="fa fa-weixin bds_weixin" data-cmd="weixin" title="生成文章二维码"></a>
            <a href="#" class="fa fa-share-alt bds_more" data-cmd="more"></i></a>
        </div>
        <script>
            window._bd_share_config={
                "common":{"bdSnsKey":{},"bdText":"RocketMQ实战（一）　| Lost Youth　","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"24"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];
        </script>
    

    
</div>







    




    <div class="scroll" id="post-nav-button">
        
            <a href="/2017/04/10/head-first-git-branch/" title="上一篇: Git由浅入深之分支管理">
                <i class="fa fa-angle-left"></i>
            </a>
        

        <a title="文章列表"><i class="fa fa-bars"></i><i class="fa fa-times"></i></a>

        
            <a href="/2017/04/22/meituan-id/" title="下一篇: Leaf——美团点评分布式ID生成系统">
                <i class="fa fa-angle-right"></i>
            </a>
        
    </div>

    <ul class="post-list"><li class="post-list-item"><a class="post-list-link" href="/2017/05/20/distrute-in-action/">分布式服务化系统一致性的“最佳实干“</a></li><li class="post-list-item"><a class="post-list-link" href="/2017/05/12/spring-boot-in-action/">Spring Boot In Action</a></li><li class="post-list-item"><a class="post-list-link" href="/2017/05/04/mysql-youhua/">我必须得告诉大家的MySQL优化原理</a></li><li class="post-list-item"><a class="post-list-link" href="/2017/04/26/mysql-bizhibimui/">MySql 必知必会</a></li><li class="post-list-item"><a class="post-list-link" href="/2017/04/26/java-8-in-action/">Java8 In Action</a></li><li class="post-list-item"><a class="post-list-link" href="/2017/04/26/java-8-in-practice/">Java8学习笔记</a></li><li class="post-list-item"><a class="post-list-link" href="/2017/04/23/distribute-micro-service-1/">微服务业务开发三个难题－拆分、事务、查询（上）</a></li><li class="post-list-item"><a class="post-list-link" href="/2017/04/23/distribute-micro-service-2/">微服务业务开发三个难题－拆分、事务、查询（下）</a></li><li class="post-list-item"><a class="post-list-link" href="/2017/04/22/meituan-id/">Leaf——美团点评分布式ID生成系统</a></li><li class="post-list-item"><a class="post-list-link" href="/2017/04/10/rocket-in-practice-1/">RocketMQ实战（一）</a></li><li class="post-list-item"><a class="post-list-link" href="/2017/04/10/head-first-git-branch/">Git由浅入深之分支管理</a></li><li class="post-list-item"><a class="post-list-link" href="/2017/04/10/tomcat-principle/">Tomcat组成与工作原理</a></li><li class="post-list-item"><a class="post-list-link" href="/2017/04/10/tomcat-cluster/">Tomcat 集群实现源码级别剖析</a></li><li class="post-list-item"><a class="post-list-link" href="/2017/04/04/mysql-7-join/">Mysql的七种join</a></li><li class="post-list-item"><a class="post-list-link" href="/2017/04/04/hello-world/">Hello World</a></li></ul>




    <script>
        
    </script>
</div>
      <footer id="footer">
    <div class="outer">
        <div id="footer-info">
            <div class="footer-left">
                <i class="fa fa-copyright"></i> 
                2016-2017 xiaoyou
            </div>
            <div class="footer-right">
                <a href="http://hexo.io/" target="_blank" title="快速、简洁且高效的博客框架">Hexo</a>  Theme <a href="https://github.com/MOxFIVE/hexo-theme-yelee" target="_blank" title="简而不减 Hexo 双栏博客主题  v3.5">Yelee</a> by MOxFIVE <i class="fa fa-heart animated infinite pulse"></i>
            </div>
        </div>
        
            <div class="visit">
                
                    <span id="busuanzi_container_site_pv" style='display:none'>
                        <span id="site-visit" title="本站到访数"><i class="fa fa-user" aria-hidden="true"></i><span id="busuanzi_value_site_uv"></span>
                        </span>
                    </span>
                
                
                    <span>| </span>
                
                
                    <span id="busuanzi_container_page_pv" style='display:none'>
                        <span id="page-visit"  title="本页阅读量"><i class="fa fa-eye animated infinite pulse" aria-hidden="true"></i><span id="busuanzi_value_page_pv"></span>
                        </span>
                    </span>
                
            </div>
        
    </div>
</footer>
    </div>
    
<script data-main="/js/main.js" src="//cdn.bootcss.com/require.js/2.2.0/require.min.js"></script>

    <script>
        $(document).ready(function() {
            var iPad = window.navigator.userAgent.indexOf('iPad');
            if (iPad > -1 || $(".left-col").css("display") === "none") {
                var bgColorList = ["#9db3f4", "#414141", "#e5a859", "#f5dfc6", "#c084a0", "#847e72", "#cd8390", "#996731"];
                var bgColor = Math.ceil(Math.random() * (bgColorList.length - 1));
                $("body").css({"background-color": bgColorList[bgColor], "background-size": "cover"});
            }
            else {
                var backgroundnum = 5;
                var backgroundimg = "url(/background/bg-x.jpg)".replace(/x/gi, Math.ceil(Math.random() * backgroundnum));
                $("body").css({"background": backgroundimg, "background-attachment": "fixed", "background-size": "cover"});
            }
        })
    </script>





<div class="scroll" id="scroll">
    <a href="#" title="返回顶部"><i class="fa fa-arrow-up"></i></a>
    <a href="#comments" onclick="load$hide();" title="查看评论"><i class="fa fa-comments-o"></i></a>
    <a href="#footer" title="转到底部"><i class="fa fa-arrow-down"></i></a>
</div>
<script>
    // Open in New Window
    
        var oOpenInNew = {
            
            
            
            
            
            
             archives: ".archive-article-title", 
             miniArchives: "a.post-list-link", 
            
             friends: "#js-friends a", 
             socail: ".social a" 
        }
        for (var x in oOpenInNew) {
            $(oOpenInNew[x]).attr("target", "_blank");
        }
    
</script>

<script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js">
</script>
  </div>
</body>
</html>